drop database xwplat
go

/*==============================================================*/
/* Database: xwplat                                             */
/*==============================================================*/
create database xwplat
go

use xwplat
go

/*==============================================================*/
/* Table: INFORM_INFO                                           */
/*==============================================================*/
create table INFORM_INFO (
   ID                   int                  identity,
   ITITLE               nvarchar(50)         null,
   ICONTENT             nvarchar(3000)       null,
   ICREATE_TIME         datetime             null,
   ICREATE_DEPARTMENT_ID int                  null,
   IDELETE              int                  null,
   IDELETE_TIME         datetime             null,
   IGRADE               int                  null,
   PID                  int                  null,
   constraint PK_INFORM_INFO primary key (ID)
)
go

if exists (select 1 from  sys.extended_properties
           where major_id = object_id('INFORM_INFO') and minor_id = 0)
begin 
   declare @CurrentUser sysname 
select @CurrentUser = user_name() 
execute sp_dropextendedproperty 'MS_Description',  
   'user', @CurrentUser, 'table', 'INFORM_INFO' 
 
end 


select @CurrentUser = user_name() 
execute sp_addextendedproperty 'MS_Description',  
   '通知公告基本信息', 
   'user', @CurrentUser, 'table', 'INFORM_INFO'
go

/*==============================================================*/
/* Table: INFORM_USER_TARGET                                    */
/*==============================================================*/
create table INFORM_USER_TARGET (
   ID                   int                  identity,
   IID                  int                  null,
   UID                  int                  null,
   "READ"               int                  null,
   READ_TIME            datetime             null,
   constraint PK_INFORM_USER_TARGET primary key (ID)
)
go

if exists (select 1 from  sys.extended_properties
           where major_id = object_id('INFORM_USER_TARGET') and minor_id = 0)
begin 
   declare @CurrentUser sysname 
select @CurrentUser = user_name() 
execute sp_dropextendedproperty 'MS_Description',  
   'user', @CurrentUser, 'table', 'INFORM_USER_TARGET' 
 
end 


select @CurrentUser = user_name() 
execute sp_addextendedproperty 'MS_Description',  
   '通知公告信息与用户对应表', 
   'user', @CurrentUser, 'table', 'INFORM_USER_TARGET'
go

/*==============================================================*/
/* Table: LC_POWER_STATION                                      */
/*==============================================================*/
create table LC_POWER_STATION (
   ID                   int                  identity,
   PNAME                nvarchar(20)         null,
   PLINK                nvarchar(200)        null,
   ISOVER               int                  null,
   PTOP                 numeric(4,2)         null,
   PLEFT                numeric(4,2)         null,
   LPOSITION            int                  null,
   DESCRIBE             nvarchar(2000)       null,
   constraint PK_LC_POWER_STATION primary key (ID)
)
go

if exists (select 1 from  sys.extended_properties
           where major_id = object_id('LC_POWER_STATION') and minor_id = 0)
begin 
   declare @CurrentUser sysname 
select @CurrentUser = user_name() 
execute sp_dropextendedproperty 'MS_Description',  
   'user', @CurrentUser, 'table', 'LC_POWER_STATION' 
 
end 


select @CurrentUser = user_name() 
execute sp_addextendedproperty 'MS_Description',  
   '澜沧江电站信息', 
   'user', @CurrentUser, 'table', 'LC_POWER_STATION'
go

/*==============================================================*/
/* Table: LC_USER                                               */
/*==============================================================*/
create table LC_USER (
   ID                   int                  identity,
   UNAME                nvarchar(20)         null,
   PSWORD               nvarchar(20)         null,
   UTYPE                int                  null,
   XM                   nvarchar(20)         null,
   PID                  int                  null,
   constraint PK_LC_USER primary key (ID)
)
go

if exists (select 1 from  sys.extended_properties
           where major_id = object_id('LC_USER') and minor_id = 0)
begin 
   declare @CurrentUser sysname 
select @CurrentUser = user_name() 
execute sp_dropextendedproperty 'MS_Description',  
   'user', @CurrentUser, 'table', 'LC_USER' 
 
end 


select @CurrentUser = user_name() 
execute sp_addextendedproperty 'MS_Description',  
   '澜沧江集团用户', 
   'user', @CurrentUser, 'table', 'LC_USER'
go

/*==============================================================*/
/* Table: SERVER_USER_INFO                                      */
/*==============================================================*/
create table SERVER_USER_INFO (
   ID                   int                  identity,
   UNAME                nvarchar(20)         null,
   PASSWD               nvarchar(20)         null,
   SNAME                nvarchar(20)         null,
   IP                   nvarchar(20)         null,
   PID                  int                  null,
   DESCRIBE             nvarchar(2000)       null,
   constraint PK_SERVER_USER_INFO primary key (ID)
)
go

if exists (select 1 from  sys.extended_properties
           where major_id = object_id('SERVER_USER_INFO') and minor_id = 0)
begin 
   declare @CurrentUser sysname 
select @CurrentUser = user_name() 
execute sp_dropextendedproperty 'MS_Description',  
   'user', @CurrentUser, 'table', 'SERVER_USER_INFO' 
 
end 


select @CurrentUser = user_name() 
execute sp_addextendedproperty 'MS_Description',  
   '桌面虚拟化服务器的用户信息', 
   'user', @CurrentUser, 'table', 'SERVER_USER_INFO'
go

/*==============================================================*/
/* Table: SYS_INFO                                              */
/*==============================================================*/
create table SYS_INFO (
   ID                   int                  identity,
   SYS_NAME             nvarchar(100)        null,
   SYS_HOME             nvarchar(100)        null,
   SYS_ONLINE           int                  null,
   SYS_TYPE             int                  null,
   SYS_DESCRIBE         nvarchar(1000)       null,
   PID                  int                  null,
   SSO                  int                  null,
   SYS_ICON             nvarchar(200)        null,
   SYS_COLOR            char(10)             null,
   SYS_SHADOW           char(10)             null,
   constraint PK_SYS_INFO primary key (ID)
)
go

if exists (select 1 from  sys.extended_properties
           where major_id = object_id('SYS_INFO') and minor_id = 0)
begin 
   declare @CurrentUser sysname 
select @CurrentUser = user_name() 
execute sp_dropextendedproperty 'MS_Description',  
   'user', @CurrentUser, 'table', 'SYS_INFO' 
 
end 


select @CurrentUser = user_name() 
execute sp_addextendedproperty 'MS_Description',  
   '集成平台中，系统的基本信息', 
   'user', @CurrentUser, 'table', 'SYS_INFO'
go

/*==============================================================*/
/* Table: SYS_USER_INFO                                         */
/*==============================================================*/
create table SYS_USER_INFO (
   UID                  int                  not null,
   SID                  int                  not null,
   SORDER               int                  null,
   constraint PK_SYS_USER_INFO primary key (UID, SID)
)
go

if exists (select 1 from  sys.extended_properties
           where major_id = object_id('SYS_USER_INFO') and minor_id = 0)
begin 
   declare @CurrentUser sysname 
select @CurrentUser = user_name() 
execute sp_dropextendedproperty 'MS_Description',  
   'user', @CurrentUser, 'table', 'SYS_USER_INFO' 
 
end 


select @CurrentUser = user_name() 
execute sp_addextendedproperty 'MS_Description',  
   '用户系统对应表', 
   'user', @CurrentUser, 'table', 'SYS_USER_INFO'
go